package com.tencent.sr.iris.activity.service.config;

import com.google.common.collect.Maps;
import com.tencent.sr.iris.activity.interfaces.dto.SceneInfoMappingDTO;
import com.tencent.sr.tech.dynamic.config.spring.annotation.DynamicConfigObject;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.springframework.stereotype.Component;

import java.util.Map;

@Getter
@Setter
@Accessors(chain = true)
@ToString
@Component
@DynamicConfigObject(key = "sceneConfig")
public class SceneConfig {

    /**
     * 通过场景id获取对应
     */
    public Map<String, SceneInfoMappingDTO> sceneIdMap = Maps.newHashMap();

    public SceneInfoMappingDTO getSceneInfoByScene(String scene) {
        SceneInfoMappingDTO sceneInfoMappingDTO = sceneIdMap.get(scene);
        if (sceneInfoMappingDTO == null) {
            return null;
        }
        return sceneInfoMappingDTO.clone();
    }
}
